package com.victor.bingwallpaper.bean;

import java.util.Objects;

public class Images {
    private String desc;
    private String date;
    private String url;
    private String dir;

    public String toString() {
        String smallUrl = this.url + "&pid=hp&w=384&h=216&rs=1&c=4";
        return String.format("![](%s)%s [download 4k](%s)", smallUrl, this.date, this.url);
    }

    public String formatMarkdown() {
        return String.format("%s | [%s](%s) ", this.date, this.desc, this.url);
    }

    public String toLarge() {
        String smallUrl = this.url + "&w=1000";
        return String.format("![](%s)Today: [%s](%s)", smallUrl, this.desc, this.url);
    }

    public String getDesc() {
        return this.desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public String getDate() {
        return this.date;
    }

    public void setDate(String date) {
        this.date = date;
    }

    public String getUrl() {
        return this.url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getDir() {
        return this.dir;
    }

    public void setDir(String dir) {
        this.dir = dir;
    }

    public Images() {
    }

    public Images(String desc, String date, String url) {
        this.desc = desc;
        this.date = date;
        this.url = url;
        this.dir = this.dir;
    }

    public boolean equals(Object o) {
        if (this == o) {
            return true;
        } else if (o != null && this.getClass() == o.getClass()) {
            Images images = (Images)o;
            return Objects.equals(this.desc, images.desc) && Objects.equals(this.date, images.date) && Objects.equals(this.url, images.url);
        } else {
            return false;
        }
    }

    public int hashCode() {
        return Objects.hash(new Object[]{this.desc, this.date, this.url});
    }
}
